<template>
  <div class="detail">
    <template v-if="type === 'self'">
      <div class="box-name">
        <div class="head-icon">
          <el-avatar
            slot="reference"
            class="user-icon"
            :src="infoData.headUrl"
            size="large"
            v-if="infoData && infoData.headUrl"></el-avatar>
          <el-avatar
            slot="reference"
            class="user-icon"
            :src="infoData.gender === '女' ? circleUrlW : circleUrlM"
            size="large"
            v-else></el-avatar>
        </div>
        <div class="name">{{ infoData.userName }}</div>
      </div>
      <div class="box-introduce">
        <div class="box-li">
          <div class="li">
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con" :title="infoData.orgName">{{ infoData.orgName || emptyText }}</div>
          </div>
          <div class="li">
            <i class="iconfont icon-pdrenwu-ren"></i>
            <div class="li-con">{{ infoData.userIdentity || emptyText }}</div>
          </div>
        </div>
        <div class="box-li">
          <div class="li">
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con">{{ infoData.birthday || emptyText }}</div>
          </div>
          <div class="li">
            <i class="iconfont icon-pdrenwu-ren"></i>
            <div class="li-con">{{ infoData.age || emptyText }}</div>
          </div>
        </div>
        <div class="box-li">
          <div class="li">
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con">{{ infoData.education || emptyText }}</div>
          </div>
          <div class="li">
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con">{{ infoData.gender || emptyText }}</div>
          </div>
        </div>
        <div class="box-li">
          <div class="li">
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con">{{ infoData.politics || emptyText }}</div>
          </div>
          <div class="li">
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con" :title="infoData.entryTime + infoData.entryType">
              <span v-if="infoData.entryTime || infoData.entryType">
                {{ infoData.entryTime }}{{ infoData.entryType }}
              </span>

              <span v-else>{{ emptyText }}</span>
            </div>
          </div>
        </div>
      </div>
      <div class="box_duty">
        <div class="duty-title">岗位职责</div>
        <div
          class="duty-con"
          v-if="infoData.postDuty != null && infoData.postDuty.length > 0"
          v-html="infoData.postDuty"></div>
        <div class="no_data" v-else>
          <empty></empty>
        </div>
      </div>
    </template>
    <template v-if="type === 'org'">
      <div class="box-name">
        <div class="head-icon">
          <el-avatar
            slot="reference"
            class="user-icon"
            src="@images/jxgl/icon_window.png"
            size="large"
            v-if="infoData.orgName && infoData.orgName.includes('窗口')"></el-avatar>
          <el-avatar slot="reference" class="user-icon" src="@images/jxgl/icon_org.png" size="large" v-else></el-avatar>
        </div>
        <div class="name">{{ infoData.orgName }}</div>
      </div>
      <div class="box-introduce">
        <div class="box-li">
          <div class="oli">
            <div class="label">部门负责人</div>
            <i class="iconfont icon-pdrenwu-ren"></i>
            <div class="li-con">{{ infoData.orgLeader }}</div>
          </div>
        </div>
        <div class="box-li">
          <div class="oli">
            <div class="label">部门总人数</div>
            <i class="iconfont icon-pdNMStubiao-"></i>
            <div class="li-con">{{ infoData.orgNumber }}人</div>
          </div>
        </div>
      </div>
      <div class="box_duty">
        <div class="duty-title">部门职责</div>
        <div class="duty-con" v-if="infoData.orgDuty != null" v-html="infoData.orgDuty"></div>
        <div class="no_data" v-else>
          <empty></empty>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  name: 'InfoDetail',
  components: {},
  props: {
    type: String,
    infoData: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      emptyText: '暂无',
      circleUrlM: require('@images/user-icon.png'),
      circleUrlW: require('@images/user-icon-G.png'),
    }
  },
  computed: {},
  filters: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="scss" scoped>
.detail {
  background-color: #ffffff;
  border-radius: 4px;
  height: 100%;
  margin-right: 20px;
  padding: 20px;
  color: #5a5a5a;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .box-name {
    display: flex;
    align-items: center;
    color: #000000;

    .head-icon {
      width: 50px;
      height: 50px;
      margin-right: 20px;
      /deep/.user-icon {
        width: 100%;
        height: 100%;
        img {
          width: 100%;
        }
      }
    }

    .name {
      font-weight: 600;
      font-size: 20px;
    }
  }

  .box-introduce {
    padding-top: 10px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 2px dashed #e8e8e8;

    .box-li {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin: 10px 0;

      .li {
        width: 47.5%;
        display: flex;
        align-items: center;

        .iconfont {
          color: #81d3f8;
        }

        .label {
          font-weight: 600;
          margin-right: 10px;
        }

        i {
          margin-right: 5px;
        }

        .li-con {
          flex: 1;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }

        &:first-child {
          margin-right: 5%;
        }
      }

      .oli {
        width: 95%;
        display: flex;
        align-items: center;

        .label {
          font-weight: 600;
          margin-right: 30px;
        }

        i {
          margin-right: 5px;
        }

        .li-con {
          flex: 1;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
    }
  }

  .box_duty {
    overflow-y: auto;

    .duty-title {
      font-weight: 600;
      font-size: 18px;
    }

    .duty-con {
      margin-top: 15px;
      line-height: 1.5;
      white-space: pre-wrap;
    }
  }
}
.no_data {
  height: calc(100% - 50px);
}
</style>
